home *** CD-ROM | disk | FTP | other *** search
Gui4CLI script | 1999-05-14 | 1.6 KB | 71 lines |
- G4C
-
- ; ---- Parsing variables : splitting them into parts
-
- winbig -1 -1 450 140 'ParseVar'
- wintype 11110001
- usetopaz
-
- xonload
-
- ; ---- The purpose of the list explained
-
- lvuse ParseVar.gc 1
- lvadd 'The parts of'
- lvadd 'what you enter'
- lvadd 'will be listed'
- lvadd 'here.'
- guiopen ParseVar.gc
-
- xonclose
- guiquit ParseVar.gc
-
- ; ---- Header, and definition
-
- Text 80 4 120 10 'Parsing a Variable' 20 NOBOX
- Text 20 30 160 10 'That means :' 28 NOBOX
- Text 40 50 160 10 'Splitting a variable' 28 NOBOX
- Text 40 60 160 10 'into its parts.' 28 NOBOX
-
- ; ---- A listview to display the results of parsevar
-
- xListView 290 14 150 90 'The parts' v '' 0 TXT
- gadid 1
-
-
- ; ---- some text to guide you down the right path..
-
- Text 30 106 220 10 'Enter a few words here, and press <Return>.' 50 NOBOX
-
- ; ---- Anything enter into the xTextIn gadget below will be parsed and the
- ; results displayed in the listview.
-
-
- xTextIn 10 120 400 16 '' entry '' 256
-
- ; ---- This is the important line. The entry is parsed.
-
- parsevar entry
-
- ; ---- At this point, parse.total holds the number of words
- ; in 'entry'.
- ; Each word is contained in parse.1, parse.2, and so on.
- ; $$parse.total, $$parse.1, etc are INTERNAL VARIABLES.
-
- ; Clear the list first
- lvclear
-
- ; Loop through the set of words, adding each one to
- ; the next line of the list.
-
- setvar c 0
- while $c < $$parse.total ; While our counter is less than the total
- pp = '\$\$parse.$c' ; Make the name of the next parse.n var
- lvadd $pp ; Add that name to the list
- c == $c + 1 ; Increment the counter
- endwhile ; Done
-
-
-
-
-